import type { CSSOptions } from 'vite';

/**
 * css的配置项目
 * @description 如果是导入scss则注入scss的亮色主题
 * @param importCssType - 导入css还是scss
 */
export function cssOption(importCssType: 'css' | 'scss'): CSSOptions {
  const lightScss = '@use "@/styles/vite/element-plus-light.scss" as *;';
  const scssImportStr = `
      @use "@/styles/vite/var-colors.scss" as *;
      @use "@/styles/vite/var-number.scss" as *;
      @use "@/styles/vite/mixin.scss" as *;`;

  return {
    preprocessorOptions: {
      scss: {
        api: 'modern-compiler',
        additionalData: importCssType === 'scss' ? lightScss + scssImportStr : scssImportStr, // scss注入
      },
    },
  };
}
